<?php
require 'PHPMailerAutoload.php';
$address = $_POST['email'];
$mail = new PHPMailer;
$ini_array = parse_ini_file("qiao.ini");
$host = $ini_array[ip_address];
$pwd = $ini_array[emailpassword];
//$mail->SMTPDebug = 3;                               // Enable verbose debug output
$mail->Charset='UTF-8';
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '3050315638@qq.com';                 // SMTP username
$mail->Password = $pwd;                           // SMTP password
$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;                                    // TCP port to connect to

$mail->setFrom('3050315638@qq.com', '乔梁');
$mail->addAddress($address, $address);     // Add a recipient
//$mail->addAddress('ellen@example.com');               // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML
$mail->Subject = '验证码';
$mail->Body    = $host.'/zuoye.php';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}